package com.liu.design.behavior.chain.simple;

/**
 * @author LIU
 * @version 1.0
 * @description: TODO
 * @date 2022/12/20 14:26
 */
public class Teacher {

    private String name;
    private Teacher next;

    public Teacher(String name) {
        this.name = name;
    }

    public Teacher getNext() {
        return next;
    }

    public void setNext(Teacher next) {
        this.next = next;
    }

    void handleRequest(){
        System.out.println(this+"  -----正在处理.....");

        if (next !=null){
            next.handleRequest();
        }
    }

    @Override
    public String toString() {
        return "Teacher{" +
                "name='" + name + '\'' +
                '}';
    }
}
